/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package z.h.w.jar.kit.clazz;

import z.h.w.jar.data.time.Time;
import z.h.w.jar.data.time.Unit;

/**
 *
 * @author EnzoZhong
 */
public class Fila {

      private Time startTime;
      private Time nowTime;
      private Integer startNum;
      private Integer nowNum;
      private Integer yourNum;

      /**
       *
       */
      public Fila () {
      }

      /**
       *
       * @param nowNum
       */
      public void setNowNum ( Integer nowNum ) {
            this.nowNum = nowNum;
      }

      /**
       *
       * @param nowTime
       */
      public void setNowTime ( Time nowTime ) {
            this.nowTime = nowTime;
      }

      /**
       *
       * @param startNum
       */
      public void setStartNum ( Integer startNum ) {
            this.startNum = startNum;
      }

      /**
       *
       * @param startTime
       */
      public void setStartTime ( Time startTime ) {
            this.startTime = startTime;
      }

      /**
       *
       * @param yourNum
       */
      public void setYourNum ( Integer yourNum ) {
            this.yourNum = yourNum;
      }

      /**
       *
       * @return
       */
      public Time eta () {
            Long now = nowTime.getTime ();
            Long start = startTime.getTime ();
            Long interval = now - start;

            Long pass = Long.valueOf ( nowNum - startNum + 1 );

            Long each = interval / pass;
            System.out.println ();
            return startTime.offset (
                    new Double ( each * yourNum ) ,
                    Unit.MILLISECOND );
      }

}
